const express = require('express');
const router = express.Router();
const db = require('../db/db');
const { login } = require('../sql/sql');

/* post login listing. */
router.post('/', function (req, res) {
  const account = req.body.account || ``
  const pwd = req.body.pwd || ``

  if (account && pwd) {
    const sql = login(account, pwd);
    db.querySql(sql, {}, function (error, data) {
      res.send(data);
    })
  } else {
    res.json(`用户名或者密码不可为空`);
  }
});

module.exports = router;
